<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
  String scheme = request.getScheme();
  String serverName = request.getServerName();
  int serverPort = request.getServerPort();
  String contextPath = request.getContextPath();
  String servletPath = request.getServletPath();
  
  
  String basePath = scheme + "://" + serverName + ":" + serverPort + contextPath + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BasePath</title>
</head>
<body>
scheme:<%=scheme %><br>
serverName:<%=serverName  %><br>
serverPort:<%=serverPort %><br>
contextPath:<%=contextPath %><br>
servletPath:<%=servletPath %><br>
<br>
basePath:<%=basePath %><br>
<br>
Link:<br>
1. <a href="haveBase.jsp">Have Base</a>：測試有加  &lt;base&gt; 其 url<br>
2. <a href="noBase.jsp">No Base</a>：測試沒有加  &lt;base&gt; 其 url<br>
</body>
</html>